package model.skill;

import java.util.HashMap;
import java.util.Map;

public class SkillLibrary {

	static private SkillLibrary instance = null;
	
	private static Map<String, Skill> skills;
	
	private SkillLibrary()
	{
		skills = new HashMap<String, Skill>();
		initLibrary();
	}
	
	public static SkillLibrary getInstance() {
		if ( instance != null ) {
			return instance;
		}
		return instance = new SkillLibrary();
	}
	
	public void initLibrary()
	{
		Skill observationSkill = new Observation();
		Skill detectTrapSkill = new DetectTrap();
		Skill projectileSkill = new ProjectileSkill(SkillType.PROJECTILE, SkillType.PROJECTILE, 10, ProjectileLibrary.getLinearProjectile("linearProjectileMediumSpeedAndMediumDamageAndShortDistance"), false);
		Skill baneSkill = new Bane();
		Skill boonSkill = new Boon();
		Skill enchantmentSkill = new Enchantment();
		Skill bindWoundsSkill = new BindWounds();
		Skill oneHandedWeaponSkill = new OneHandedWeapon();
		Skill twoHandedWeaponSkill = new TwoHandedWeapon();
		Skill brawlingSkill = new Brawl();
		Skill staffSkill = new Staff();
		Skill rangedSkill = new Ranged();
		
		skills.put("observationSkill", observationSkill);
		skills.put("detectTrapSkill", detectTrapSkill);
		skills.put("projectileSkill", projectileSkill);
		skills.put("baneSkill", baneSkill);
		skills.put("boonSkill", boonSkill);
		skills.put("enchantmentSkill", enchantmentSkill);
		skills.put("bindWoundsSkill", bindWoundsSkill);
		skills.put("oneHandedWeaponSkill", oneHandedWeaponSkill);
		skills.put("twoHandedWeaponSkill", twoHandedWeaponSkill);
		skills.put("brawlingSkill", brawlingSkill);
		skills.put("staffSkill", staffSkill);
		skills.put("rangedSkill", rangedSkill);
	}
	
	public static Skill getSkill(String name)
	{
		return skills.get(name);
	}
}
